FROM centos:7

RUN yum install -y gcc gcc-c++ unzip make curl-devel mysql-devel git vim tree wget lsof psmisc automake flex bison

# from https://github.com/Kitware/CMake/releases/download/v3.22.5/cmake-3.22.5.tar.gz
COPY cmake-3.22.5.tar.gz /tmp/

RUN cd /tmp && tar -zxvf cmake-3.22.5.tar.gz; \
    cd /tmp && cd cmake-3.22.5; ./bootstrap; \
    cd /tmp && cd cmake-3.22.5; gmake && gmake install;

# from git clone https://github.com/TarsCloud/TarsCpp.git --recursive
COPY TarsCpp.git_v_3ff6359173c087473032bff35ced648fbfaa0520.p_v_c1b0f6122921ee01f6660cdd6f2e4ae7d57f879e.tgz /tmp/
RUN cd /tmp && tar -zxvf TarsCpp.git_v_3ff6359173c087473032bff35ced648fbfaa0520.p_v_c1b0f6122921ee01f6660cdd6f2e4ae7d57f879e.tgz; \
    cd /tmp && cd TarsCpp; cmake . && make && make install;

RUN cd /opt ; \
    git clone https://gitee.com/feiyifeng/neiku.git ; \
    cp -v /opt/neiku/bin/neiku_config /usr/local/bin/;  \
    cd /opt/neiku/3rd/clearsilver && make install prefix=/opt/clearsilver; \
    cd /opt/neiku/3rd/jsoncpp && make install PREFIX=/opt/jsoncpp; \
    cd /opt/neiku/3rd/fastcgi && make install prefix=/opt/fastcgi; \
    cd /opt/neiku/3rd/tinyxml2 && make install prefix=/opt/tinyxml2; \
    cd /opt/neiku/3rd/wxapi-aes-sdk && make install prefix=/opt/wxapi-aes-sdk; \
    cd /opt/neiku/3rd/yaml-cpp && make install prefix=/opt/yaml-cpp; \
    cd /opt/neiku/src/neiku && make clean && make

